﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Windows.Forms;
using System.Drawing;

namespace Zampolit
{
    class AnimaButton
    {
        public PictureBox Pic{get; set; }
        public TextBox TBox{get; set; }
        public Image Active{get; set; } 
        public Image Passive{get; set; }
        public string Text{ get; set; }

        public AnimaButton()
        { 
        }
        public AnimaButton(PictureBox pic, TextBox tbox, Image active, Image passive, string text)
        {
            Pic = pic;
            TBox = tbox;
            Active = active;
            Passive = passive;
            Text = text;

            Pic.Image = Passive;
        }

        public void SetPassive()
        {
            Pic.Image = Passive;
            Pic.MouseLeave += Pic_MouseLeave;
            Pic.MouseMove += Pic_MouseMove;
        }
       
        private void Pic_MouseMove(object sender, MouseEventArgs e)
        {
            if (Pic.Image != Active)
            {
                Pic.Image = Active;
                TBox.Text = Text; 
            }   
        }

        private void Pic_MouseLeave(object sender, EventArgs e)
        {
            if (Pic.Image != Passive)
            {
                Pic.Image = Passive;
                TBox.Clear();
            }
        }

        

    }
}
